-- Disable 
select 'ALTER INDEX '+i.Name+' on ' +  TB.name +' DISABLE; GO;'  FROM SYS.indexes as i
join SYS.tables as TB on i.object_ID=TB.object_ID
where TB.name='GL_Star_FactsDetails'


select 'ALTER INDEX '+i.Name+' on ' +  TB.name +' DISABLE; '  FROM SYS.indexes as i
join SYS.tables as TB on i.object_ID=TB.object_ID
where TB.name in ('GL_Star_SubLedger', 'RD4_Monitor_GL')


-- rebuild indexes
select 'ALTER INDEX '+i.Name+' on ' +  TB.name +' REBUILD;'  FROM SYS.indexes as i
join SYS.tables as TB on i.object_ID=TB.object_ID
where TB.name='GL_Star_FactsDetails'


select 'ALTER INDEX '+i.Name+' on ' +  TB.name +' REBUILD; '  FROM SYS.indexes as i
join SYS.tables as TB on i.object_ID=TB.object_ID
where TB.name in ('GL_Star_SubLedger', 'RD4_Monitor_GL')